<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <meta name="description" content="" />
    <meta name="author" content="" />
    <title>{{blogname}}博客 - Bootstrap</title>
    <link rel="icon" type="image/x-icon" href="/static/assets/favicon.ico" />
    <!-- Font Awesome icons (free version)-->
    <script src="https://use.fontawesome.com/releases/v5.15.3/js/all.js" crossorigin="anonymous"></script>
    <!-- Google fonts-->
    <link href="https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" rel="stylesheet"
        type="text/css" />
    <link
        href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800"
        rel="stylesheet" type="text/css" />
    <!-- Core theme CSS (includes Bootstrap)-->
    <link href="/static/css/styles.css" rel="stylesheet" />
</head>

<body>
    <!-- Navigation-->
    <nav class="navbar navbar-expand-lg navbar-light" id="mainNav">
        <div class="container px-4 px-lg-5">
            <a class="navbar-brand" href="index" style="font-size: 20px;">{{blogname}}博客</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive"
                aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
                菜单
                <i class="fas fa-bars"></i>
            </button>
            <div class="collapse navbar-collapse" id="navbarResponsive">
                <ul class="navbar-nav ms-auto py-4 py-lg-0">
                    {% for i in labels %}
                    <li class="nav-item"><a class="nav-link px-lg-3 py-3 py-lg-4" href="{{i}}"
                            style="font-size: 20px;">{{labels[i]}}</a></li>
                    {% endfor %}
                </ul>
            </div>
        </div>
    </nav>
    <!-- Page Header-->
    <header class="masthead" style="background-image: url('/static/assets/img/home-bg.jpg')">
        <div class="container position-relative px-4 px-lg-5">
            <div class="row gx-4 gx-lg-5 justify-content-center">
                <div class="col-md-10 col-lg-8 col-xl-7">
                    <div class="site-heading">
                        <h1>{{blogname}}博客</h1>
                        <span class="subheading">{{blogname}}博客</span>
                    </div>
                </div>
            </div>
        </div>
    </header>
    <!-- Main Content-->
    <div class="container px-4 px-lg-5">
        <div class="row gx-4 gx-lg-5 justify-content-center">
            <div class="col-md-10 col-lg-8 col-xl-7">
                <!-- Post preview-->
                {% for i in articles %}
                <div class="post-preview">
                    <a href="post?ArticleId={{i.ArticleId}}">
                        <h2 class="post-title">{{i.ArticleTitle}}</h2>
                        <h3 class="post-subtitle"
                            style="display:-webkit-box;-webkit-box-orient:vertical;white-space:nowrap;line-clamp:5;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis ;">
                            {{i.ArticleContent}}</h3>
                    </a>
                    <p class="post-meta">
                        Posted by
                        <a href="#!">{{blogname}}博客</a>
                        {{i.CreatTime}}
                    </p>
                    {% if validate %}
                    <button data-articlesid="{{i.ArticleId}}" class="del_del btn btn-outline-danger">删除</button>
                    {% endif %}
                </div>
                <!-- Divider-->
                <hr class="my-4" />

                {% endfor %}
                <!-- Pager-->
                <!-- <div class="d-flex justify-content-end mb-4"><a class="btn btn-primary text-uppercase" href="#!">之前的文章
                        →</a></div> -->
            </div>
        </div>
    </div>
    <!-- Footer-->
    <footer class="border-top">
        <div class="container px-4 px-lg-5">
            <div class="row gx-4 gx-lg-5 justify-content-center">
                <div class="col-md-10 col-lg-8 col-xl-7">
                    <ul class="list-inline text-center">
                        <li class="list-inline-item">
                            <a href="#!">
                                <span class="fa-stack fa-lg">
                                    <i class="fas fa-circle fa-stack-2x"></i>
                                    <i class="fab fa-twitter fa-stack-1x fa-inverse"></i>
                                </span>
                            </a>
                        </li>
                        <li class="list-inline-item">
                            <a href="#!">
                                <span class="fa-stack fa-lg">
                                    <i class="fas fa-circle fa-stack-2x"></i>
                                    <i class="fab fa-facebook-f fa-stack-1x fa-inverse"></i>
                                </span>
                            </a>
                        </li>
                        <li class="list-inline-item">
                            <a href="#!">
                                <span class="fa-stack fa-lg">
                                    <i class="fas fa-circle fa-stack-2x"></i>
                                    <i class="fab fa-github fa-stack-1x fa-inverse"></i>
                                </span>
                            </a>
                        </li>
                    </ul>
                    <div class="small text-center text-muted fst-italic">Copyright &copy; {{blogname}}博客
                        2023</div>
                </div>
            </div>
        </div>
    </footer>
    <!-- Bootstrap core JS-->
    <script src="/static/js/bootstrap.bundle.min.js"></script>
    <!-- Core theme JS-->
    <script src="/static/js/scripts.js"></script>
    <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script>
    <script src="https://www.jq22.com/jquery/bootstrap-3.3.4.js"></script>
    <script src="/static/jquery-validation/jquery.validate.min.js"></script>
    <script>
        $(".del_del").click(function () {
            var articlesid = $(this).data("articlesid");
            $.ajax({
                url: "/article/delete?ArticleId=" + articlesid,
                method: "Get",
                success: function (data) {
                    if (data.code == 200) {
                        alert("删除成功")
                        document.location.href = data.html_index
                    } else {
                        alert("删除失败")
                    }
                }

            })
        })
    </script>
</body>

</html>